/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.liquidByte.trafficMustang.server.webService;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import org.liquidByte.trafficMustang.server.services.MainService;
import org.liquidByte.trafficMustang.server.webService.base.WebService;

/**
 * REST Web Service
 *
 * @author Alexandre
 */
@Stateless
@Path("main")
public class MainWebService extends WebService {
    
    @EJB
    private MainService service;

    @GET
    @Produces("application/json")
    @Path("get")
    public String get() {
        try {
            return this.result(this.service.get());
        } catch (Exception e) {
            return this.error(e);
        }
    }

    @GET
    @Produces("application/json")
    @Path("alternarPerfil")
    public String alternarPerfil() {
        try {
            this.service.alternarPerfil();
            return this.result(this.service.get());
        } catch (Exception e) {
            return this.error(e);
        }
    }
    
    @GET
    @Produces("application/json")
    @Path("getUpdates")
    public String getUpdates() {
        try {
            return this.result(this.service.getUpdates());
        } catch (Exception e) {
            return this.error(e);
        }
    }
}
